<?php

/**
 * @author ducnhat
 * @email ddnhat@gmail.com
 * @copyright 2014
 */
 
class PageController extends Zenddn_Controller_Action{
	
    public function init(){
		parent::init();
        parent::loadTemplate('magashop');
        $this->view->page = "howto";
	}
	
	public function indexAction(){
	    $data = $this->getPageContent('about');
        
        $this->view->data = $data;
	}
    
    public function howtoinstallAction(){
	    $data = $this->getPageContent('how_to_install');
        
        $this->view->data = $data;
	}
    
    public function warrantyAction(){
	    $data = $this->getPageContent('warranty');
        
        $this->view->data = $data;
	}
    
    public function howtobuyAction(){
	    $data = $this->getPageContent('how_to_buy');
        
        $this->view->data = $data;
	}
    
    public function helpAction(){
	    $data = $this->getPageContent('help');
        
        $this->view->data = $data;
	}
    
    public function blogAction(){
	    //$data = $this->getPageContent('blog');
        
        //$this->view->data = $data;
	}
    
    private function getPageContent($page){
        $model = new Default_Model_Setting();
        $pageSetting = unserialize($model->getSetting('page'));
        
        $id = $pageSetting[$page];
        
        $post_model = new Default_Model_Post();
        $post = $post_model->getData($id, array('content'));
        
        return $post;
    }
}